package com.qfedu.department.dto;

import java.util.ArrayList;
import java.util.List;

import com.qfedu.common.entity.WoActivitiTaskLog;
import com.qfedu.common.entity.WoPage;
import com.qfedu.department.po.QfLeave;

/**
 * PO实体QfLeave对应的DTO类.
 * @author cailei
 */
public class QfLeaveDto extends QfLeaveDto_ {

	/**
	 * 无参构造函数
	 */
	public QfLeaveDto() {
		super ();
	}

	/**
	 * 构造函数,通过po构造dto
	 */
	public QfLeaveDto(QfLeave po) {
		super (po);
	}
	
	/**
	 * 将po列表数据转化为dto列表数据
	 * @param pos
	 * @return
	 */
	public static List<QfLeaveDto> getDtos (List<QfLeave> pos) {
		List<QfLeaveDto> rs = new ArrayList<QfLeaveDto>();
		for (QfLeave r : pos) {
			QfLeaveDto dto = new QfLeaveDto(r);
			rs.add(dto);
		}
		return rs;
	}
	
	/**
	 * 将分页po数据转化为dto分页数据
	 * @param pos
	 * @param total
	 * @return
	 */
	public static WoPage<QfLeaveDto> getPageData(List<QfLeave> pos, Long total) {
		WoPage<QfLeaveDto> puDto = new WoPage<QfLeaveDto>(getDtos(pos), total);
		return puDto;
	}
	
	private Boolean candidate = false;

	public Boolean isCandidate() {
		return candidate;
	}

	public void setCandidate(Boolean candidate) {
		this.candidate = candidate;
	}
	
	/**
	 * 1-审批中，2-通过，3-不通过
	 */
	private String result = "1";

	public String getResult() {
		return result;
	}

	public String getResultName() {
		String name = "审批中";
		if (result == null) {
			return name;
		}
		switch (result) {
		case "2":
			name = "通过";
			break;
		case "3":
			name = "不通过";
			break;
		}
		return name;
	}
	
	public void setResult(String result) {
		this.result = result;
	}
	
	/**
	 * 
	 */
	private List<WoActivitiTaskLog> logs = new ArrayList<WoActivitiTaskLog>();

	public List<WoActivitiTaskLog> getLogs() {
		return logs;
	}

	public void setLogs(List<WoActivitiTaskLog> logs) {
		this.logs = logs;
	}
}
